Create a Verifiable Credential
1. Install
npm install @extrimian/vc-core
2. Create a credential
To create your first credential you must have created a DID and its keys saved in the KMS storage. If you haven't done this yet go to the previous section Creation of a DID.
import { VerifiableCredentialService } from "@extrimian/vc-core";
const vcService = new VerifiableCredentialService();
const credential = await vcService.createCredential({
context: [
"https://w3id.org/vaccination/v1",
"https://w3id.org/security/v2",
"https://w3id.org/security/bbs/v1",
],
vcInfo: {
issuer: "did:quarkid:zksync:EiCvhchHLnK1HOM1vlQJTSW0TotsNfe34zFbGXisg3fMzA",
expirationDate: new Date("2026/05/05"),
id: "123456789",
types: ["VaccinationCertificate"],
},
data: {
type: "VaccinationEvent",
batchNumber: "1183738569",
administeringCentre: "MoH",
healthProfessional: "MoH",
countryOfVaccination: "NZ",
recipient: {
type: "VaccineRecipient",
givenName: "JOHN",
familyName: "SMITH",
gender: "Male",
birthDate: "1958-07-17",
},
vaccine: {
type: "Vaccine",
disease: "COVID-19",
atcCode: "J07BX03",
medicinalProductName: "COVID-19 Vaccine Moderna",
marketingAuthorizationHolder: "Moderna Biotech",
},
},
mappingRules: null,
});
3. Test
console.log(credential);